
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include <iostream>
using namespace std;

int main( int argc, char* args[] )
{
    //The images
    SDL_Surface* fishimage = NULL;      //SDL_Surface is an image (so we have 2 images here)
    SDL_Surface* screen = NULL;
    Uint32 clearColor;			//needed for changing color of background
    
    
    //Start SDL
    SDL_Init( SDL_INIT_EVERYTHING );            //lets us start using graphics stuff
    
    //Set up screen
    screen = SDL_SetVideoMode( 800, 600, 32, SDL_SWSURFACE );       //(640 pixels wide, 480 pixels high, 32 bits per pixel, in software memory)
    


    //******steps to change background color******
    SDL_Rect screenRect;
    screenRect.x = screenRect.y = 0;
    screenRect.w = screen->w;
    screenRect.h = screen->h;
    clearColor = SDL_MapRGB(screen->format, 0, 0, 255);
    SDL_FillRect(screen, &screenRect, clearColor);
    //******end steps to change background color******

    //Load image
    fishimage = IMG_Load("marlin.jpg"); //loads marlin image
 
    
 
   //Apply images to screen
    SDL_BlitSurface( fishimage, NULL, screen, NULL );       //(source surface, destination surface)

    
    //Update Screen
    SDL_Flip( screen );         //updates screen so we can see the image
    
    //Pause
    SDL_Delay( 3000 );          //leaves the image on the screen for 3 seconds (3000 milliseconds)
    
    //Free the loaded image
    SDL_FreeSurface( fishimage );   //removes the image from memory because we will not be using it anymore in the program
    
    
    
    //Quit SDL
    SDL_Quit();
    
    return 0;    
}
